package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 十进制转二进制  字符串操作版本
 * Date:2021/4/4
 * ***************************************************************
 */
public class exc5_37 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		
		System.out.print("Enter a number in Decimal:  ");
		int number10=input.nextInt();
		
		StringBuilder number2=new StringBuilder("");
		
		while(number10>0) {
			number2.insert(0,(char)((int)'0'+number10%2)+"");
			number10/=2;
		}
		System.out.print("10->2  number is  "+number2);
		
	}

}
